package wanghomework;

import java.util.Scanner;

public class Year {
    /**
     * 2.输入某年某月某日，判断这一天是这一年的第几天？
     */
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入年：");
        int year = input.nextInt();
        System.out.println("请输入月：");
        int month = input.nextInt();
        System.out.println("请输入日：");
        int day = input.nextInt();
        int sum = 0;
        if(year%4 == 0){
            if(month==1){
                System.out.println("这是"+year+"的第"+day+"天");
            }
            else if(month == 2) {
                sum = 31+day;
                System.out.println("这是"+year+"的第"+sum+"天");
            }
            else if(month > 2 && month < 8){
                for (int i = 3; i < month; i++) {
                        sum = 60;
                    if(month%2 == 0){
                        sum = sum+30;
                    }else {
                        sum = sum+31;
                    }
                }
                sum = sum +day;
                System.out.println("这是"+year+"的第"+sum+"天");
            }
            else {
                for (int i = 8; i < month; i++) {
                    sum = 60;
                    if(month%2 == 0){
                        sum = sum+31;
                    }else {
                        sum = sum+30;
                    }
                }
                sum = sum +day;
                System.out.println("这是"+year+"的第"+sum+"天");
            }
        }
        else{
            if(month==1){
                System.out.println("这是"+year+"的第"+day+"天");
            }
            else if(month == 2) {
                sum = 31+day;
                System.out.println("这是"+year+"的第"+sum+"天");
            }
            else if(month > 2 && month < 8){
                for (int i = 3; i < month; i++) {
                    sum = 59;
                    if(month%2 == 0){
                        sum = sum+30;
                    }else {
                        sum = sum+31;
                    }
                }
                sum = sum +day;
                System.out.println("这是"+year+"的第"+sum+"天");
            }
            else {
                for (int i = 8; i < month; i++) {
                    sum = 59;
                    if(month%2 == 0){
                        sum = sum+31;
                    }else {
                        sum = sum+30;
                    }
                }
                sum = sum +day;
                System.out.println("这是"+year+"的第"+sum+"天");
            }
        }


    }
}
